﻿using Prism.Commands;
using Prism.Mvvm;
using Prism.Navigation;
using Prism.Navigation.Regions;

namespace BlankApp1.ViewModels
{
    internal class MainViewModel : BindableBase
    {
        private string _title = "标题0";
        private readonly IRegionManager regionManager;

        public string Title
        {
            get { return _title; }
            set { SetProperty(ref _title, value); }
        }

        public DelegateCommand<string> OpenCommand { get; private set; }

        public MainViewModel(IRegionManager regionManager)
        {
            OpenCommand = new DelegateCommand<string>(Open);
            this.regionManager = regionManager;
        }

        private void Open(string obj)
        {
            // 实例化A
            NavigationParameters keys = new NavigationParameters();
            keys.Add("Title", "Hello");
            regionManager.Regions["ContentRegion"].RequestNavigate(obj, keys);

        }
    }
}
